app.controller("longRend", ['$scope','$window',"$stateParams","$http","$cookieStore",'$state', function($scope,$window,$stateParams,$http,$cookieStore,$state) {

    // 设置title
    console.log($stateParams.title)
    if($stateParams.title==1){
        $window.document.title='长租详情'
    }else if($stateParams.title==2){
        $window.document.title='民宿详情'
    }else if($stateParams.title==3){
        $window.document.title='营业房详情'
    }else if($stateParams.title==4){
        $window.document.title='住房出售详情'
    } 
    //房屋详细信息数据
       // 判断登录函数
       $scope.login()


// PartData
    $http({
        method: 'post',
        url:$scope.httptit+'/index/house/detail.html',
        data:{ 
            id:$stateParams.id,            
            userid:$cookieStore.get('login').id,
        },
        dataType:'json',
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
        transformRequest:$scope.changeData
    }).then(function successCallback(response) {
        $scope.PartDescData=response.data.data               
        console.log($scope.PartDescData)
    }, function errorCallback(response) {
        console.log(response)
    // 请求失败执行代码
    });

 

    //收藏与取消收藏
    $scope.shoucang=function(val,id){
        $http({
            method: 'post',
            url:$scope.httptit+'/index/house/favorite.html',
            data:{
                status:val,
                houseid:id,
                userid:$cookieStore.get('login').id,
            },
        dataType:'json',
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
        transformRequest:$scope.changeData
        }).then(function successCallback(response) {
            console.log(response.data)
            $scope.PartDescData.collect=response.data.data
        }, function errorCallback(response) {
            console.log(response)
        // 请求失败执行代码
        });  
    }

    $(".comment").infinite().on("infinite", function() {
        var self = this;
        if(self.loading) return;
        console.log(self)
        self.loading = true;
        console.log(self);
        setTimeout(function() {
        console.log("123")
          self.loading = false;
        }, 2000);   //模拟延迟
      });
}]);